package com.corpgovernment.organization.enumm;

import com.ctrip.corp.obt.generic.utils.StringUtils;

import java.util.Arrays;

public enum MbImportExcelRecordStatusEnum {
    U("U","进行中"),
    E("E","完成"),
    F("F","失败");
    private String dealCode;
    private String desc;

    MbImportExcelRecordStatusEnum(String dealCode, String desc) {
        this.dealCode = dealCode;
        this.desc = desc;
    }

    public String getDealCode() {
        return dealCode;
    }

    public void setDealCode(String dealCode) {
        this.dealCode = dealCode;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static String getStatusName(String dealCode) {
        if (StringUtils.isEmpty(dealCode)) {
            return null;
        }
        MbImportExcelRecordStatusEnum recordTypeEnum = Arrays.stream(MbImportExcelRecordStatusEnum.values()).filter(x -> x.getDealCode().equals(dealCode)).findFirst().orElse(null);
        if (recordTypeEnum == null) {
            return null;
        }
        return recordTypeEnum.getDesc();
    }
}
